//package com.zhiyou.shiro;
//
//import org.apache.shiro.authc.*;
//import org.apache.shiro.realm.AuthenticatingRealm;
//import org.apache.shiro.util.ByteSource;
//
///**
// * @Author: lee
// * @Date: 2021/10/19 10:17
// */
//public class SecondRealm extends AuthenticatingRealm {
//
//    //认证
//    @Override
//    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
//
//        System.out.println(" =========shiro   realm============ " );
//        System.out.println("authenticationToken = " + authenticationToken);
//        //从authenticationToken 获取用户名
//        UsernamePasswordToken token= (UsernamePasswordToken) authenticationToken;
//        //根据用户名查询密码
//        String username=token.getUsername();
//        System.out.println("username = " + username);
//        //若用户不存在，抛出异常
//        //构建AuthenticationInfo  并返回
//        //参数1 认证的实体信息 username
//        Object principal=username;
//        //参数2密码
//        // String credentials="123456";
//        String credentials="93c3ef4bc1b01b865028192eeda1a41d";
//        String realName=getName();
//        //   AuthenticationInfo authenticationInfo=new SimpleAuthenticationInfo(principal,credentials,realName);
//        ByteSource salt=ByteSource.Util.bytes(username);
//        AuthenticationInfo authenticationInfo=new SimpleAuthenticationInfo(principal,credentials,salt,realName);
//        return authenticationInfo;
//    }
//}
